package com.zjw.javase.reflect.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

import org.junit.Test;

public class TestDynamicProxy {

	@Test
	public void test01(){
		Subject subject = new SubjectImpl();
		ClassLoader loader = this.getClass().getClassLoader();
		Class[] interfaces = subject.getClass().getInterfaces();
		InvocationHandler h = new MyInvocationHandlerImpl(subject);
		Subject subjectProxy = (Subject)Proxy.newProxyInstance(loader, interfaces, h);
		subjectProxy.love();

	}
}
